<?php

declare(strict_types=1);

namespace DreamCat\StateMachine\Popo\Health;

use DreamCat\StateMachine\Popo\ActionExecConditionFail;
use DreamCat\StateMachine\Popo\ActionStatus;
use DreamCat\StateMachine\Popo\PreConditionFailResult;
use Throwable;

/**
 * 下一动作的信息
 * @author vijay
 */
class NextActorInfo
{
    /** @var string 动作名称 */
    private string $actionName;
    /** @var Throwable|null 检查遇到的异常 */
    private ?Throwable $exception = null;
    /** @var PreConditionFailResult|null 前置条件的检查结果 */
    private ?PreConditionFailResult $preConditionFailResult = null;
    /** @var ActionStatus|null 检查函数的结果 */
    private ?ActionStatus $actionStatus = null;
    /** @var ActionExecConditionFail|null 后置条件的检查结果 */
    private ?ActionExecConditionFail $actionExecConditionFail = null;
    /** @var string[] 可操作人员列表 */
    private array $operatorList;
    /** @var bool 是否主流程 */
    private bool $mainStream;

    /**
     * @return bool 是否主流程
     */
    public function isMainStream(): bool
    {
        return $this->mainStream;
    }

    /**
     * @param bool $mainStream 是否主流程
     * @return NextActorInfo
     */
    public function setMainStream(bool $mainStream): NextActorInfo
    {
        $this->mainStream = $mainStream;
        return $this;
    }

    /**
     * @return PreConditionFailResult|null 前置条件的检查结果
     */
    public function getPreConditionFailResult(): ?PreConditionFailResult
    {
        return $this->preConditionFailResult;
    }

    /**
     * @param PreConditionFailResult|null $preConditionFailResult 前置条件的检查结果
     * @return NextActorInfo
     */
    public function setPreConditionFailResult(?PreConditionFailResult $preConditionFailResult): NextActorInfo
    {
        $this->preConditionFailResult = $preConditionFailResult;
        return $this;
    }

    /**
     * @return string[] 可操作人员列表
     */
    public function getOperatorList(): array
    {
        return $this->operatorList;
    }

    /**
     * @param string[] $operatorList 可操作人员列表
     * @return NextActorInfo
     */
    public function setOperatorList(array $operatorList): NextActorInfo
    {
        $this->operatorList = $operatorList;
        return $this;
    }

    /**
     * @return string
     */
    public function getActionName(): string
    {
        return $this->actionName;
    }

    /**
     * @param string $actionName
     * @return NextActorInfo
     */
    public function setActionName(string $actionName): NextActorInfo
    {
        $this->actionName = $actionName;
        return $this;
    }

    /**
     * @return Throwable|null
     */
    public function getException(): ?Throwable
    {
        return $this->exception;
    }

    /**
     * @param Throwable|null $exception
     * @return NextActorInfo
     */
    public function setException(?Throwable $exception): NextActorInfo
    {
        $this->exception = $exception;
        return $this;
    }

    /**
     * @return ActionStatus|null
     */
    public function getActionStatus(): ?ActionStatus
    {
        return $this->actionStatus;
    }

    /**
     * @param ActionStatus|null $actionStatus
     * @return NextActorInfo
     */
    public function setActionStatus(?ActionStatus $actionStatus): NextActorInfo
    {
        $this->actionStatus = $actionStatus;
        return $this;
    }

    /**
     * @return ActionExecConditionFail|null 后置条件的检查结果
     */
    public function getActionExecConditionFail(): ?ActionExecConditionFail
    {
        return $this->actionExecConditionFail;
    }

    /**
     * @param ActionExecConditionFail|null $actionExecConditionFail 后置条件的检查结果
     * @return NextActorInfo
     */
    public function setActionExecConditionFail(?ActionExecConditionFail $actionExecConditionFail): NextActorInfo
    {
        $this->actionExecConditionFail = $actionExecConditionFail;
        return $this;
    }
}

# end of file
